home *** CD-ROM | disk | FTP | other *** search
/ Risc World 7 / Risc World 7.iso / Software / Issue4 / IYONIX / MANICMINER / SOURCE.ZIP / manicminer-1.6.3 / gfxlibs / libggi / c / keyboard < prev    next >
Encoding:
Text File  |  2000-12-01  |  623 b   |  32 lines

  1. #include "common.h"
  2. #include "keyboard.h"
  3.  
  4. int
  5. mm_keyb_pressed (int scancode)
  6. {
  7.   int counter;
  8.   if (scancode != KEYB_ANYKEY)
  9.     return (keytab[scancode]);
  10.   else
  11.     for (counter = 1; counter < 127; counter++)
  12.       if (keytab[counter])
  13.     return (1);
  14.   return (0);
  15. }
  16.  
  17. void
  18. mm_keyb_update (void)
  19. {
  20.   ggi_event event;
  21.   ggi_event_mask mask;
  22.   struct timeval t = { 0, 0 };
  23.  
  24.   while ((mask = ggiEventPoll (vis, emKey, &t))) {
  25.     ggiEventRead (vis, &event, emKey);
  26.     if (event.any.type == evKeyPress)
  27.       keytab[event.key.button] = 1;
  28.     else if (event.any.type == evKeyRelease)
  29.       keytab[event.key.button] = 0;
  30.   }
  31. }
  32.